'''
Created on May 20, 2009

@author: mkiyer

Elixir version of AnnotationDB -- this is older and deprecated

'''

from elixir import metadata, session, setup_all, create_all, Entity, Field, String, Integer, BLOB
from elixir.options import using_options

class Annotation(Entity):
    '''
    database object representing a genome annotation
    
    Fields ---
    chrom: chromosome in UCSC format e.g. 'chr1', 'chrX', etc
    chromStart: starting location on chromosome, numbering starts from zero
    chromEnd: ending location on chromosome, exclusive e.g. the region (0, 100) includes bases 0 through 99
    name: name of this annotation e.g. TMPRSS2, ChIPseq_ERG_HPeak, etc
    type: type of annotation (gene, protein binding site, motif, etc)
    '''
    # set the table name
    using_options(tablename="annotations")

    # define the database
    chrom = Field(String(255), required=True)
    chromStart = Field(Integer, required=True)
    chromEnd = Field(Integer, required=True)
    name = Field(BLOB, required=True)
    type = Field(String(255), required=True)
        
    def __repr__(self):
        return '<Annotation %s %s %s %s %s>' % (self.chrom, self.chromStart, self.chromEnd, self.name, self.type)
